<template>
	<!-- 农户申请 -->
	<view class="box">
		<u-form :model="form" ref="uForm">
			<u-form-item label="银行开户名全称" label-width="260"><u-input v-model="form.bank_name" /></u-form-item>
			<u-form-item label="银行账号" label-width="260"><u-input v-model="form.bank_code" /></u-form-item>
			<u-form-item label="开户行" label-width="260"><u-input v-model="form.bank" /></u-form-item>
			<u-form-item label="申请人姓名" label-width="260"><u-input v-model="form.apply_name" /></u-form-item>
			<u-form-item label="申请人电话" label-width="260"><u-input v-model="form.apply_phone" /></u-form-item>
			<u-form-item label="是否可提供发票" label-width="260">
				<u-radio-group v-model="is_fp">
					<u-radio v-for="(item, index) in fpList" :key="index" :name="item.name" :disabled="item.disabled">
						{{ item.name }}
					</u-radio>
				</u-radio-group>
			</u-form-item>
		</u-form>
		<button class="submitBtn" @click="submit">提交</button>
		<!-- 登录提示 -->
		<shopro-auth-modal></shopro-auth-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				maxCount:1,
				token: uni.getStorageSync('token'),
				form: {
					bank_name: '',
					bank_code: '',
					bank:"",
					apply_name:"",
					apply_phone:"",
					is_fp:"",
				},
				showAddress:false,
				fpList: [
					{
						name: '否',
						value:0,
						disabled: false
					},
					{
						name: '是',
						value:1,
						disabled: false,
					}
				],
				is_fp:'',
			}
		},
		watch:{
			is_fp(){
				if(this.is_fp =='否'){
					this.form.is_fp =0;
				}else if(this.is_fp=='是'){
					this.form.is_fp= 1;
				}
			}
		},
	
		onShow() {
			this.njsApplyData();
		},
		methods: {
			njsApplyData(){
				var _this = this;
				_this.$http('apply.njsApplyData',{}).then(res=>{
					if(res.code !=1){
						uni.showModal({
							title:res.msg,
							success(){
								uni.switchTab({
									url:"/pages/index/index"
								})
							}
						})
					}else{
						
					}
				})
			},
			//提交
			submit(){
				var _this = this;
				_this.$http('apply.njsApplySubmit',_this.form).then(res=>{
					if(res.code == 1){
						uni.showToast({
							title:'提交成功',
							icon:'none'
						})
						uni.switchTab({
							url:"/pages/index/index"
						})
					}else{
						uni.showToast({
							title:"提交失败",
							icon:'none',
						})
					}
				})
			},
			// addressSelect(e){
			// 	this.form.address = e.province.label+e.city.label+e.area.label;
			// },
			// // 上传图片成功
			// uploadSuccess(e) {
			// 	this.imgList = [];
			// 	e.forEach(item => {
			// 		this.form.idcard_gh_image= item.response.data.url;
			// 	});
			// },
			// // 移除图片
			// uploadRemove(index) {
			// 	this.form.idcard_gh_image = '';
			// },
			// // 上传图片成功
			// uploadSuccess2(e) {
			// 	this.imgList = [];
			// 	e.forEach(item => {
			// 		this.form.idcard_rx_image= item.response.data.url;
			// 	});
			// },
			// // 移除图片
			// uploadRemove2(index) {
			// 	this.form.idcard_rx_image = '';
			// },
		}
	}
</script>

<style>
	page{
		
		background-color: #fff;
	}
	.box{
		width: 90%;
		margin: 30rpx auto;
	}
	.submitBtn{
		width: 90%;
		background-color: #03A9F4;
		color: #fff;
	}
</style>
